﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MQC.record
{
    public partial class FAAddPersonNo : System.Web.UI.Page
    {
        static string batch, department;
        protected void Page_Load(object sender, EventArgs e)
        {
            batch = Request.QueryString["batch"].ToString();
            department = Request.QueryString["department"].ToString();
        }

        protected void Btn_Click(object sender, EventArgs e)
        {
            using (DbAppDataContext db = new DbAppDataContext())
            {
                string[] batchs = batch.Split('|');
                bool run = true;
                string perosnNo = "";
                string bt = "";
                foreach (var n in batchs)
                {
                    perosnNo = DDPerson.Text.Trim().ToString();
                    bt = n.ToString();
                    if (run)
                    {
                        FA_Record data = db.FA_Record.SingleOrDefault(c => c.Batch == bt);
                        data.Person = perosnNo;
                        db.SubmitChanges();
                        string s = string.Format("<script>alert('成功');</script>", n);
                        Response.Write(s);
                    }
                }
            }
        }
    }
}